#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
int main(int argc,const char* argv[]){
    if(argc != 3){
        return -1;
    }
    FILE*fp = fopen(argv[2],"r");
    if(fp == NULL){
        printf("fopen err\n");
        return -1;
    }
    printf("________fopen success_______\n");

//打印
    char ch=0;
    int n=0;
    n-=atoi(argv[1]);
    if(n <= 0){
        return -1;
    }
    while(n){
        ch =fgetc(fp);

        if(ch !=-1){
            printf("%c",ch);
        }else{
            n--;
        }
        if(ch == '\n'){
            n--;
        }
    }
    if(ch == -1){
        printf("\n");
    }


    if(ferror(fp)){
        perror("err");
    }else if(feof(fp)){
        printf("_______end of file_______\n");
    }

    fclose(fp);
    fp=NULL;
    return 0;
}